import sys,re,os
a=sys.argv[1]
p0=a+r'\res\values'

def r0(p):
	f=open(p0+p,'r')
	s=f.read()
	f.close()
	return s

d1={}
l=re.findall('(?<=<public type="string" name=")[\w\.]+?(?=" id="0x\w+?" />)',r0(r'\public.xml'))


def d0(lan):
	d={}
	if not os.path.exists(p0+lan+r'\strings.xml'):return d
	s=r0(lan+r'\strings.xml')
	a=re.findall('<string name="([\w\.]+?)"(.*?>[\w\W]*?)</string>',s)
	for i in a:d[i[0]]=i[1]
	a=re.findall('<string name="([\w\.]+?)" />',s)
	for i in a:d[i[0]]=False
	return d

def f0(lan):
	global l,d1
	d=d0(lan)
	for i in d:
		if i in l:
			d1[i]=d[i]
			l.remove(i)

for i in ['-zh-rCN','-zh','','-hu']:f0(i)

print l


f=open(p0+r'\strings1.xml','w')
f.write('<?xml version="1.0" encoding="utf-8"?>\n<resources>\n')
for i in d1:
	if d1[i]:f.write('    <string name="'+i+'"'+d1[i]+'</string>\n')
	else:f.write('    <string name="'+i+'" />\n')
f.write('</resources>')
f.close()
